# Maintainer: Thore Bödecker <foxxx0@archlinux.org>
# Contributor: Tim Meusel <tim@bastelfreak.de>

_gemname='nats-pure'
pkgname="ruby-${_gemname}"
pkgver=2.2.1
pkgrel=1
pkgdesc="Ruby client for the NATS messaging system"
url="https://github.com/nats-io/nats-pure.rb"
arch=('any')
license=('MIT')
depends=('ruby')
makedepends=('ruby-rake' 'ruby-rspec' 'ruby-bundler' 'ruby-rdoc' 'ruby-test-unit')
options=('!emptydirs')
source=("${_gemname}-v${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz")
sha512sums=('f013512c95c5c5089701f52d72ca004ea9b0d754f6d6b92d5d401e17d4901a68f54012ad6ee7aec06adb347f6336b3b8ba538e66151f49c38ee285804a84ad30')


prepare() {
  cd "${srcdir}/${_gemname}.rb-${pkgver}"
  :
}

build() {
  cd "${srcdir}/${_gemname}.rb-${pkgver}"
  mkdir -p pkg
  gem build -o "pkg/${_gemname}-${pkgver}.gem"
}

check() {
  cd "${srcdir}/${_gemname}.rb-${pkgver}"
  # testsuite requires a running nats server to test against
  #rake spec
}

package() {
  cd "${srcdir}/${_gemname}.rb-${pkgver}"
  local _gemdir="$(gem env gemdir)"

  gem install \
    --verbose \
    --ignore-dependencies \
    --no-user-install \
    --install-dir "${pkgdir}/${_gemdir}" \
    --bindir "${pkgdir}/usr/bin" \
    "pkg/${_gemname}-${pkgver}.gem"

  rm -rf "${pkgdir}/${_gemdir}/cache"

  install -D -m644 "LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

# vim: ts=2 sw=2 et:
